Return to start page
Core/Interface/Library Selection.j
1 library ALibraryCoreInterfaceSelection
2
3 function IsPlayerSelectionEmpty takes player user returns boolean
4 local group selectedUnits = CreateGroup()
5 local boolean result = true
6 call GroupEnumUnitsSelected(selectedUnits, user, null)
7 if (selectedUnits != null) then
8 set result = false
9 endif
10 call DestroyGroup(selectedUnits)
11 set selectedUnits = null
12 return result
13 endfunction
14
15 function GetFirstSelectedUnitOfPlayer takes player user returns unit
16 local group selectedUnits = null
17 local unit selectedUnit = null //Startwert, falls die Gruppe leer ist
18 set selectedUnits = GetUnitsSelectedAll(user)
19 set selectedUnit = FirstOfGroup(selectedUnits)
20 call DestroyGroup(selectedUnits)
21 set selectedUnits = null
22 return selectedUnit
23 endfunction
24
25 /// Makes a unit select- or unselectable by removing or adding the gasshopper ability.
26 function MakeUnitSelectable takes unit usedUnit, boolean selectable returns nothing
27 if (selectable) then
28 call UnitRemoveAbility(usedUnit, 'Aloc')
29 else
30 call UnitAddAbility(usedUnit, 'Aloc')
31 endif
32 endfunction
33
34 endlibrary